package com.bolt.admin.module.sys.entity;

import com.bolt.common.utils.CompareUtil;
import com.bolt.support.spring.jpa.entity.BaseEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * Auto Generate Javadoc
 *
 * @author 日期:2018-02-07 17:27:11
 *         列明细配置
 **/
@Access(AccessType.FIELD)
@Entity
@Table(name = "sys_table_head_config")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE,region="tableConfigCache")
public class TableHeadConfig extends BaseEntity<String> implements Comparable <TableHeadConfig> {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(length = 40)
    @GeneratedValue(generator = "hibernate-uuid")
    @GenericGenerator(name = "hibernate-uuid", strategy = "org.hibernate.id.UUIDGenerator")
    private String id;

    @Column(name = "TABLE_ID", length = 36, insertable = true, updatable = false)
    private String tableId;

    @Column(name = "EDIT_TYPE", length = 10)
    private String editType
            ;
    @Column(name = "HEAD_ALIGN", length = 10)
    private String align;

    @Column(name = "HEAD_FIELD", length = 50)
    private String field;

    @Column(name = "HEAD_RENDER", length = 200)
    private String render;

    @Column(name = "HEAD_TITLE", length = 100)
    private String title;

    @Column(name = "HEAD_WIDTH", length = 10)
    private int width;

    @Column(name = "HIDDEN", length = 3)
    private boolean hidden;

    @Column(name = "ORDER_RANK", length = 10)
    private Integer orderRank;

    @Column(name = "SORTABLE", length = 3)
    private boolean sortable;


    @Override
    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTableId() {
        return tableId;
    }

    public void setTableId(String tableId) {
        this.tableId = tableId;
    }

    public String getEditType() {
        return editType;
    }

    public void setEditType(String editType) {
        this.editType = editType;
    }

    public String getAlign() {
        return align;
    }

    public void setAlign(String align) {
        this.align = align;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public String getRender() {
        return render;
    }

    public void setRender(String render) {
        this.render = render;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public boolean getHidden() {
        return hidden;
    }

    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }

    public Integer getOrderRank() {
        return orderRank;
    }

    public void setOrderRank(Integer orderRank) {
        this.orderRank = orderRank;
    }

    public boolean getSortable() {
        return sortable;
    }

    public void setSortable(boolean sortable) {
        this.sortable = sortable;
    }

    @Override
    public int compareTo(TableHeadConfig o) {
        return CompareUtil.compare(this.getOrderRank(), o.getOrderRank());
    }
}